[MUSIC] Welcome to Explore Advanced Retrievers
in LangChain, part one. After watching this video, you'll be able to
explain what LangChain retrievers are. You will also be able to describe
the vector store-based retriever and explain how it works. Let's begin by understanding
what a LangChain retriever is. A LangChain retriever is an interface
that returns documents based on an unstructured query. It is more general than a vector store. It doesn't necessarily store documents
as its purpose is to retrieve them or their chunks. A LangChain retriever accepts
a string query as input and returns a list of documents or
chunks as output. Although the process of
retrieving data sounds simple, it can be subtly complex with
several implementations possible. Let's learn more about the simplest
type of retriever the vector store-based retriever which retrieves
documents from a vector database. Recall that this vector database is
brought into existence by loading source documents, splitting them into chunks,
and embedding them. The vector store-based retriever plugs
into this existing vector store. It accepts a query and
retrieves the most similar data, in this case the most similar chunks. The vector store-based retriever
works by embedding the query and then comparing it with embedded
chunks using similarity search or maximum marginal relevance, also known as
MMR, to retrieve the most relevant chunks. The vector store-based retriever is
simple to understand because it queries an existing vector store and does not require an LLM to
retrieve the most similar chunks. In addition to using a similarity score, you can use maximum marginal
relevance retrieval or MMR. MMR in vector stores is a technique
used to balance the relevance and diversity of retrieved results. It selects documents that are both
highly relevant to the query and minimally similar to
previously selected documents. This approach helps to
avoid redundancy and ensures a more comprehensive coverage
of different aspects of the query. In this particular example, the query email policy results
in three retrieved documents. Let's recap. In this video, you learned that a Lanchain
retriever is an interface that returns documents based on an unstructured query. It has several types. The vector store-based retriever is one
such type that retrieves documents from a vector database. It can be created directly from the vector
store object with the retriever method by using similarity search or MMR. Similarity search is when
the retriever accepts a query and retrieves the most similar data. MMR is a technique used to
balance the relevance and diversity of retrieved results.